package com.lj.dict.result;

import com.lj.dict.entity.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;

/**
 * <p>
 * 字典表 分页结果
 * </p>
 *
 * @author luojing
 * @since 2025-01-10 11:07:47
 */
@Data
@Schema(description = "字典表 分页结果")
public class DictPageResult {

    private Long id;

    @Schema(description = "字典名称 ")
    private String dictName;

    @Schema(description = "字典类型 ")
    private String dictType;

    @Schema(description = "字典状态 参考字典: DictStatus")
    private Integer dictStatus;

    @Schema(description = "字典描述 ")
    private String remark;

    private LocalDateTime updateTime;

    public static DictPageResult of(Dict entity) {
        if (entity == null) {
            return null;
        }
        DictPageResult result = new DictPageResult();
        result.setId(entity.getId());
        result.setDictName(entity.getDictName());
        result.setDictType(entity.getDictType());
        result.setDictStatus(entity.getDictStatus().getValue());
        result.setRemark(entity.getRemark());
        result.setUpdateTime(entity.getUpdateTime());
        return result;
    }
}
